package com.google.code.jtasks.server.modules;

import com.google.code.jtasks.server.dao.TaskDAO;
import com.google.code.jtasks.server.dao.TokenManagers.TokenManager;
import com.google.code.jtasks.server.dao.UserDAO;
import com.google.code.jtasks.server.dao.mongo.MongoTaskDAO;
import com.google.code.jtasks.server.dao.mongo.MongoUserDAO;
import com.google.code.jtasks.server.resources.TasksResource;
import com.google.code.jtasks.server.resources.UserResource;
import com.google.inject.AbstractModule;

/**
 * Main configuration module. All of jtasks-tracker configuration should be done here.
 */
public class ServerConfigurationModule extends AbstractModule {
    @Override
    protected void configure() {
        // Bind resources
       bind(TasksResource.class);
       bind(UserResource.class);

        // Bind DAO
        bind(TaskDAO.class).to(MongoTaskDAO.class);
        bind(UserDAO.class)
                .annotatedWith(BindingDBUsers.class)
                .to(MongoUserDAO.class);
        //Bind Token
        bind(TokenManager.class).to(UserResource.class);

    }
}
